using UnityEngine;
using System.Collections;

[RequireComponent(typeof(MouseOrbitPro))]
public class CameraFollowsTag : MonoBehaviour
{
	public string TagToFollow;
	
	private MouseOrbitPro _orbit;
	
	void Awake()
	{
		_orbit = GetComponent<MouseOrbitPro>();
	}
	
	void Update()
	{
		if(!_orbit.Target)
		{
			GameObject newTarget = GameObject.FindGameObjectWithTag(TagToFollow);
			if(newTarget)
				_orbit.Target = newTarget.transform;
		}
	}
}

